package maple

import scala.annotation.tailrec

object TailRecTest {

  def main(args: Array[String]): Unit = {


    val res = sum((1 to 100000000),0)
    println(res)


  }

  @tailrec
  def sum(list:Seq[Int],param:BigInt):BigInt = {
      if(list.isEmpty) param else sum(list.tail,list.head + param)
  }
}
